package com.zygh.lz.controller;

import com.zygh.lz.entity.Xrelation;
import com.zygh.lz.service.XrelationService;
import com.zygh.lz.stapprove.SysPcLog;
import com.zygh.lz.vo.ResultBean;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class XrelationController {
    @Resource
    private XrelationService xrelationService;


    @ApiOperation("批量新增民警与岗位的关联")
    @PostMapping("insertXrelation")
    //@SysPcLog(module = "批量新增民警与岗位的关联",operation = "新增")
    public ResultBean insertXrelation(@RequestBody Xrelation xrelation){
        return xrelationService.insertXrelation(xrelation);
    }

    @ApiOperation("修改民警与岗位的关联")
    @GetMapping("updateXrelation")
    //@SysPcLog(module = "修改民警与岗位的关联",operation = "修改")
    public ResultBean updateXrelation(Xrelation xrelation){
        return xrelationService.updateXrelation(xrelation);
    }

    @ApiOperation("删除岗位和人的关联")
    @GetMapping("deleteXrelatonByid")
    @SysPcLog(module = "删除民警与岗位的关联",operation = "删除")
    public ResultBean deleteXrelatonByid(Integer staffId, Integer xareaId){
        return xrelationService.deleteXrelatonByid(staffId,xareaId);
    }

    @ApiOperation("删除岗位下所有的人")
    @GetMapping("deleteXrelatonByXareaid")
    //@SysPcLog(module = "删除岗位下所有的人",operation = "删除")
    public ResultBean deleteXrelatonByXareaid(Integer id){
        return xrelationService.deleteXrelatonByXareaid(id);
    }



}
